package online.flowerinsnow.minecraft.bukkit.manhunt.event;

import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.bukkit.event.entity.EntityDamageEvent;
import org.jetbrains.annotations.NotNull;

public class PlayerDiedEvent extends Event implements Cancellable {
    public static final HandlerList handlerList = new HandlerList();
    public final Player player;
    public final EntityDamageEvent.DamageCause cause;
    public boolean cancel;
    public final Entity killer;

    public PlayerDiedEvent(Player player, EntityDamageEvent.DamageCause cause, Entity killer) {
        this.player = player;
        this.cause = cause;
        this.killer = killer;
    }

    @Override
    public @NotNull HandlerList getHandlers() {
        return handlerList;
    }
    public static HandlerList getHandlerList() {
        return handlerList;
    }

    @Override
    public boolean isCancelled() {
        return cancel;
    }

    @Override
    public void setCancelled(boolean b) {
        cancel = b;
    }
}
